package mid

func MissingRolls(rolls []int, mean int, n int) []int {
	m := len(rolls)
	sum := mean * (m + n)
	missingSum := sum
	for _, roll := range rolls {
		missingSum -= roll
	}
	if missingSum > 6*n || missingSum < n {
		return nil
	}
	avg := missingSum / n
	last := missingSum % n
	res := make([]int, n)
	for i := 0; i < n; i++ {
		temp := 0
		if i < last {
			temp++
		}
		res[i] = avg + temp
	}
	return res
}
